<template>
	<view class="settled pb-150">
		<Navigation backType="back" title="医生入驻" background="#fff" />
		<view class="bg pb-20">
			<view v-show="curt == 1">
				<view class="pt-20 f jc-c ai-c">
					<view class="w-48 h-48 b-48 yuan1 f ai-c jc-c">
						<view class="w-12 h-12 b-12 yuan2"></view>
					</view>
					<view class="w-180 h-8 heng"></view>
					<view class="w-36 h-36 b-36 yuan3 f ai-c jc-c fs-24 fw-600 text-color3">2</view>
					<view class="w-180 h-8 heng bg-heng"></view>
					<view class="w-36 h-36 b-36 yuan3 f ai-c jc-c fs-24 fw-600 text-color3">3</view>
				</view>
				<view class="f ai-c jc-c mt-16 ph-56">
					<view class="fs-26 fw-600 text-color4 w-198 f jc-c mr-22">基础信息</view>
					<view class="fs-26 text-color10 w-198 f jc-c mr-22">执业信息</view>
					<view class="fs-26 text-color10 w-198 f jc-c">入驻审核</view>
				</view>
			</view>
			<view v-show="curt == 2">
				<view class="pt-20 f jc-c ai-c">
					<image src="../../static/select-check.png" class="w-32 h-32"></image>
					<view class="w-180 h-8 heng"></view>
					<view class="w-48 h-48 b-48 yuan1 f ai-c jc-c">
						<view class="w-12 h-12 b-12 yuan2"></view>
					</view>
					<view class="w-180 h-8 heng bg-heng"></view>
					<view class="w-36 h-36 b-36 yuan3 f ai-c jc-c fs-24 fw-600 text-color3">3</view>
				</view>
				<view class="f ai-c jc-c mt-16 ph-56">
					<view class="fs-26 text-color10 w-198 f jc-c mr-22">基础信息</view>
					<view class="fs-26 text-color4 fw-600 w-198 f jc-c mr-22">执业信息</view>
					<view class="fs-26 text-color10 w-198 f jc-c">入驻审核</view>
				</view>
			</view>
		</view>
		<info ref="info" v-show="curt == 1" @fn="chanCurt" />

		<Practice ref="practice" v-show="curt == 2" @cf="submit" />

		<view v-show="curt == 3">
			<view class="box">
				<u-image src="http://cwht.ricecs.cn/app/gou.png" width="96rpx" height="96rpx"></u-image>
				<view class="title">
					提交成功
				</view>
				<!--  <view class="tips">
			                                数据提交失败，信息有误，请重新填写和操作
			                        </view> -->
				<view class="btn" @click='toHome'>
					<u-button type="info" shape="circle">返回首页</u-button>
				</view>
			</view>
		</view>


	</view>
</template>
<script setup lang="ts">
	import info from './Info.vue';
	import Practice from './Practice.vue';
	import { ref } from 'vue';
	import { doctorCreate } from '@/services/api/mine/index';
	const curt = ref(1);
	const formData = ref({
		name: '',
		identityId: '',
		avatar: '',
		subject: '',
		title: '',
		department: '',
		graduated: '',
		licenseNo: '',
		licenseUrl: '',
		sex: '',
		groupType: 1,
		skillingRemark: '',
		introduction: '',
		labelNames: '',
	});

	const chanCurt = (data : any) => {
		curt.value = 2;
		formData.value.name = data.name;
		formData.value.identityId = data.identityId;
		formData.value.subject = data.subject;
		formData.value.title = data.title;
		formData.value.department = data.department;
		formData.value.graduated = data.graduated;
		formData.value.licenseNo = data.licenseNo;
		formData.value.sex = data.sex;
		formData.value.mobile = data.mobile;
	}
	const submit = async (cu : number, data : any) => {
		console.log(cu)
		if (cu == 1) {
			curt.value = 1;
			return;
		}
		formData.value.skillingRemark = data.skillingRemark;
		formData.value.introduction = data.introduction;
		formData.value.labelNames = data.labelNames;
		formData.value.licenseUrl = data.licenseUrl;
		formData.value.avatar = data.avatar;
		await doctorCreate(formData.value);
		uni.showToast({
			title: '提交成功',
		});
		curt.value = 3



	}
	function toHome() {
		uni.switchTab({
			url: '/pages/index/index'
		})
	}
</script>
<style lang="scss" scoped>
	.settled {
		background: #f5f5f5;
		min-height: 100vh;

		::v-deep .u-textarea__count {
			background: #f8f8f8 !important;
			color: #cccccc !important;
			font-size: 24rpx !important;
		}

		::v-deep .u-textarea {
			padding: 0;
		}

		::v-deep .u-textarea__field {
			background: #f8f8f8;
			height: 220rpx !important;
		}

		::v-deep .u-button {
			height: 96rpx !important;
		}

		::v-deep .u-button__text {
			font-size: 32rpx !important;
			font-weight: 600 !important;
		}

		::v-deep .u-radio {
			margin-right: 40rpx !important;
		}

		::v-deep .u-form-item__body {
			padding: 32rpx 0 !important;
		}

		::v-deep .u-form-item__body__left__content {
			padding-right: 40rpx !important;
		}

		::v-deep .u-upload__wrap__preview {
			margin: 0 10rpx 10rpx 0 !important;
		}

		::v-deep .u-upload__wrap__preview:nth-child(4n) {
			margin: 0 0 10rpx 0 !important;
		}

		.heng {
			background: #faf4e9;
		}

		.bg-heng {
			background: #f0f0f0;
		}

		.yuan1 {
			background: #fabb3c;
			border: 8rpx solid #faf4e9;
		}

		.yuan2 {
			background: #ffffff;
		}

		.yuan3 {
			background: #f0f0f0;
		}

		.bg {
			background: #fff;
		}
	}

	.box {
		display: flex;
		align-items: center;
		flex-direction: column;
		padding-top: 230rpx;

		.title {
			margin-top: 32rpx;
			font-size: 36rpx;
			font-weight: bold;
		}

		.tips {
			margin-top: 20rpx;
			width: 460rpx;
			font-size: 28rpx;
			color: #222;
			text-align: center;
		}

		.btn {
			margin-top: 32rpx;
			width: 200rpx;
		}
	}
</style>